/*
 * edb_proto.h - EnCluster Base DB protocol-related definitions
 * Clunix, glory@clunix.com, yjlee@clunix.com, 2001.7.19.
 * Clunix, cezanne@clunix.com, 2005.3
 *
 * $Id: edb_proto.h,v 1.1.1.1.10.1 2008/01/15 00:12:25 cezanne Exp $
 *
 * Copyright (c) 2001-2005 by Clunix Inc. All Rights Reserved.
 */

#ifndef _EDB_PROTO_H_
#define _EDB_PROTO_H_

#define EDB_CMD_FLAG_MASK		0xffff0000

#define EDB_CMD_FLAG_MASTER		0x00010000

/* EDB commands ----------------------------------------------------------- */

/* connection operatoin */
#define EDB_CMD_ECHO			0x0001
#define EDB_CMD_CONNECT			0x0002
#define EDB_CMD_CLOSE			0x0003

#define EDB_CMD_MASTER_ELECTION		0x0010

/* data operations */
#define EDB_CMD_CREATE			0x0020
#define EDB_CMD_CREATE_SR		0x0021

#define EDB_CMD_GET			0x0030
#define EDB_CMD_GET_SR			0x0031
#define EDB_CMD_GET_MASTER		0x0032
#define EDB_CMD_GET_ENCSR		0x0033
#define EDB_CMD_GET_ASRV		0x0035
#define EDB_CMD_GET_MODINFOS		0x0036

#define EDB_CMD_SET			0x0040
#define EDB_CMD_SET_SR			0x0041
#define EDB_CMD_SET_CPY			0x0042
#define EDB_CMD_SET_CB			0x0043
#define EDB_CMD_UNSET_CB		0x0044
#define EDB_CMD_SET_REF			0x0045
#define EDB_CMD_ADD_REACTOR		0x0046
#define EDB_CMD_CLEAR_REACTOR		0x0047
#define EDB_CMD_RENAME			0x0050
#define EDB_CMD_MOVE			0x0051
#define EDB_CMD_CD			0x0052
#define EDB_CMD_CROP			0x0060 
#define EDB_CMD_DEL			0x0070
#define EDB_CMD_TRIGGER			0x0080
#define EDB_CMD_GETTIME			0x0085
#define EDB_CMD_XECREATE		0x0090
#define EDB_CMD_XEDELETE		0x0091
#define EDB_CMD_XETRIGGER		0x0092
#define EDB_CMD_SHUTDOWN		0x0095
#define EDB_CMD_RESTART			0x0096
#define EDB_CMD_SNAPSHOT		0x0097

#define EDB_CMD_GET_TYPENAME		0x00A0
#define EDB_CMD_GET_INHERITED_SRTS	0x00A1
#define EDB_CMD_SEARCH_SRT		0x00A2

#define EDB_CMD_FILECOPY		0x00B0
#define EDB_CMD_FILEREMOVE		0x00B1
#define EDB_CMD_FILEEXIST		0x00B2
#define EDB_CMD_FILEMKDIR		0x00B3

#define EDB_CMD_FILE_OPEN		0x00BD
#define EDB_CMD_FILE_CLOSE		0x00BE

#define EDB_CMD_AUTHUSER		0x00C3

/* string style command */
#define EDB_CMD_CMD			0x0100
#define EDB_CMD_GET_CMD			0x0200

#define EDB_CMD_SCAN			0x0400

#define EDB_CMD_ECX			0x0700

#define EDB_CMD_EXEC			0x0800

#define EDB_CMD_EXECPROCESS		0x0900

#define EDB_CMD_ADD_PATHMON		0x0a00
#define EDB_CMD_DEL_PATHMON		0x0a01

#ifdef ECM_DEBUG

#define EDB_CMD_DBGSET			0x1000

#define EDB_CMD_MTRACE_INFO		0x1001
#define EDB_CMD_MTRACE_ON		0x1002
#define EDB_CMD_MTRACE_OFF		0x1003
#define EDB_CMD_MTRACE_CLEAR		0x1004
#define EDB_CMD_MTRACE_REPORT		0x1005

#define EDB_CMD_TREELOCK_INFO		0x1011

#endif

/* EDB message types ------------------------------------------------------ */
#define EDB_PATTERN_REQ                 "req"

/* Message id number operation */
#define EDB_MSG_ID_NONE			0
#define EDB_MSG_ID_INC(_s)		do { (_s)++; if ((_s) == EDB_MSG_ID_NONE) (_s)++; } while (0)
#define EDB_MSG_ID_CMP(_a, _b)	((_a) - (_b))


#endif	/* EDB_PROTO_H */

